< previous page page_405 next page >

Page 405
    ' call routine to start recObject library
    StartProc
    '
End Sub
In Listing 10.22, you set the Tag properties of the two textboxes that are used for data entry, and then you call StartProc to start up the local copy of recObject.
Now you need to add the routine that makes the buttons call all of the library routines. Add the following code to the cmdBtn_Click event of the form:
Private Sub cmdBtn_Click(Index As Integer)
    '
    ' handle all button selections
    '
    objRec.BBProcess Me, Index, "StateProv"
    '
End Sub
This code is called every time you click any of the eight buttons on the data entry form. The BBProcess routine determines which button was pressed and performs the appropriate actions. Note that you are sending the BBProcess method three parameters: the data entry form, the index value that tells you which button was pressed, and the Search field to use if the user has pressed the Find button.
You need to add a few more lines of code to this form before you are done. First, add code that enables the buttons to automatically resize each time the form is resized. Add the following code to the Form_Resize event:
Private Sub Form_Resize()
    '
    objRec.BBInit Me
    '
End Sub
Finally, add the following code to the Form_Unload event to ensure a safe close of the database when the program ends:
Private Sub Form_Unload(Cancel As Integer)
    '
    objRec.RSClose
    '
End Sub
Save the new form as FRMSTPROV.FRM, and run the project. When the main form comes up, select Lists | StateProv from the menu to start the new form. Your form should look like the one shown in Figure 10.7.
Notice that the button set appears on the bottom of the form. This placement was handled automatically by the library routines. Resize the form to see how the button bar automatically

 
< previous page page_405 next page >

If you like this book, buy it!